home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t3_1 / doc.lha / documentation / manual / feature.mss < prev    next >
Text File  |  1987-06-30  |  19KB  |  530 lines

  1. @part[FEATURE, root "TMAN.MSS"] @Comment{-*-System:TMAN-*-}
  2. @chap[Miscellaneous features]
  3.  
  4.  
  5. @section[Comments and declarations]
  6.  
  7. @info[NOTES="Special form"]
  8. @desc[(COMMENT . @i[comment]) @yl[] @i[undefined]]
  9. Does nothing and returns no value of interest.
  10. @tc[COMMENT]-expressions may be used to write comments in code.
  11. (The preferred way to write comments, however, is with the semicolon
  12. read macro character; see page @pageref[SEMICOLON].)
  13. @EndDesc[COMMENT]
  14.  
  15. @info[NOTES="Special form"]
  16. @desc[(IGNORE . @i[variables]) @yl[] @i[undefined]]
  17. Ordinarily, programs
  18. such as compilers
  19. which manipulate source programs
  20. consider it to be an exceptional condition
  21. when a bound variable is not referenced, and may generate warning messages
  22. when they detect this condition.
  23. @tc[IGNORE]-expressions may be used to suppress such warnings
  24. and also to request that a warning be issued if in fact there are
  25. any references to @i[variables].
  26.   @begin[ProgramExample]
  27. (LAMBDA (X Y) (IGNORE X) (CAR Y))
  28.   @end[ProgramExample]
  29. @EndDesc[IGNORE]
  30.  
  31. @info[NOTES="Special form"]
  32. @desc[(IGNORABLE . @i[variables]) @yl[] @i[undefined]]
  33.  
  34. @tc[IGNORABLE] is like @tc[IGNORE] except that permission is @i[not]
  35. given to give warnings if any of @i[variables] actually is referenced.
  36. This is not useful for human-generated expressions, but may be useful
  37. in the expansion of a macro invocation where the macro expander may
  38. not know whether a bound variable in the expansion is referenced or
  39. not, and wants to declare that it is all right if the variable is
  40. not referenced.
  41.  
  42. @EndDesc[IGNORABLE]
  43.  
  44.  
  45. @section[Errors and dead ends]
  46. @label[Errors Section]  @Comment{ref: errors interface section}
  47.  
  48. @desc[(ERROR @i[control-string] . @i[arguments]) @yl[] @i[object]]
  49. Signals an error.  @i[Control-string] and @i[arguments]
  50. should be arguments suitable for a call to @tc[FORMAT]
  51. (page @pageref[FORMAT]).
  52. The error is reported in an implementation-dependent
  53. manner, and an opportunity is provided to possibly correct
  54. or proceed from the error.  (See section @ref[Errors Interface Section]
  55. for details of @Timp[]'s handling of errors.)
  56.   @begin[ProgramExample]
  57. (ERROR "cannot wash the dishes because ~A" EXCUSE-DESCRIPTION-STRING)
  58.   @end[ProgramExample]
  59. @index[Errors]
  60. @EndDesc[ERROR]
  61.  
  62. @desc[(SYNTAX-ERROR @i[control-string] . @i[arguments]) @yl[] @i[object]]
  63. Similar to @tc[ERROR], but signals a syntax error.
  64. This should be called, for example, from within macro expanders
  65. when an illegal syntax is encountered.
  66. @EndDesc[SYNTAX-ERROR]
  67.  
  68. @desc[(READ-ERROR @i[stream control-string] . @i[arguments]) @yl[] @i[object]]
  69. Similar to @tc[ERROR], but signals a read error.
  70. This should be called, for example, from within read macros
  71. when an illegal read syntax is encountered.
  72. @EndDesc[READ-ERROR]
  73.  
  74. @desc[(CHECK-ARG @i[predicate object procedure]) @yl[] @i[object]]
  75. @index[Types]
  76. Verifies that an object is of a particular type.
  77. @i[Predicate] should be a type predicate, and @i[object] can be any object.
  78. If @i[predicate], when applied to @i[object], returns false,
  79. then an error is signalled.
  80. If it returns true, then the @tc[CHECK-ARG] returns @i[object].
  81. @i[Procedure] is a procedure whose name will be given in any
  82. message printed by the error system.
  83.  
  84. The user interface (see section @ref[Errors Interface Section])
  85. may provide a way to supply a value to use in place of @i[object].
  86. If the user attempts to correct the error in this way, then
  87. @tc[CHECK-ARG] again verifies that the new value answers true to
  88. @i[predicate], and returns it.
  89.  
  90. For example:
  91.   @begin[ProgramExample]
  92. (DEFINE (WASH-DISH DISH)
  93.   (LET ((DISH (CHECK-ARG DISH? DISH WASH-DISH)))
  94.     ...))
  95.   @end[ProgramExample]
  96. @EndDesc[CHECK-ARG]
  97.  
  98. @label[UndefinedSection]        @Comment{ref: semantics chapter}
  99.  
  100. @desc[(PROCLAIM @i[predicate] @i[object]) @yl[] @i[object]]
  101. Returns @i[object], which must answer true to @i[predicate].
  102. A call to @tc[PROCLAIM] serves as a type declaration;
  103. this may assist an optimizing compiler in generating efficient code.
  104.   @begin[ProgramExample]
  105. (PROCLAIM @i[predicate] @i[object])
  106.   @ce[]
  107. (LET ((VALUE @i[object]))
  108.   (COND ((@i[predicate] VALUE) VALUE)
  109.         (ELSE (UNDEFINED-EFFECT))))
  110.   @end[ProgramExample]
  111. @enddesc[PROCLAIM]
  112.  
  113. @desc[(ASSERT @i[boolean]) @yl[] @i[undefined]]
  114. Has no effect and returns an undefined value,
  115. unless @i[boolean] is false, in which case the effect
  116. is undefined (normally, this means that an error is signalled).
  117. @enddesc[ASSERT]
  118.  
  119. @Desc[(UNDEFINED-VALUE . @i[arguments]) @yl[] @i[undefined]]
  120. @index[Undefined]
  121. Has no effect and yields some undefined value.  An implementation will
  122. endeavor to return some object which, when printed or otherwise
  123. displayed, will show the @i[arguments].  This feature may be useful in
  124. debugging, for example in tracking down the origin of the undefined
  125. value, if the value has propagated to an undesirable place.
  126. @EndDesc[UNDEFINED-VALUE]
  127.  
  128. @Desc[(UNDEFINED-EFFECT . @i[arguments]) @yl[] @i[undefined]]
  129. The effect of calling @tc[UNDEFINED-EFFECT] is undefined.  An
  130. implementation will endeavor to signal an error condition if such a call
  131. ever occurs; however, an optimizing compiler may make use of the fact
  132. that the control path leading to a call to @tc[UNDEFINED-EFFECT] will
  133. never be taken in a correctly running program, and so in some cases may
  134. eliminate the call.
  135. @EndDesc[UNDEFINED-EFFECT]
  136.  
  137.  
  138. @begin[group]
  139.  
  140. @section[Early binding]
  141. @index[Early binding]
  142.  
  143. @dc{ Streamline the following!  Talk about early vs. late binding and
  144. incremental redefinition. }
  145.  
  146. @info[NOTES="Special form"]
  147. @desc[(DEFINE-CONSTANT @i[variable value]) @yl[] @i[undefined]]
  148. This is semantically identical to @tc[DEFINE], but also declares that
  149. the value of the variable will not change.  This might permit a compiler
  150. to perform constant-folding.
  151. Also, if the variable is defined to be a small integer, this may
  152. interact well with @tc[SELECT] to obtain fast numeric dispatch on
  153. @qu"enumerated types."
  154. @EndDesc[DEFINE-CONSTANT]
  155.  
  156. @end[group]
  157.  
  158. @AnEquivE[Tfn="DEFINE-INTEGRABLE",Efn="DEF-OPEN-CODED"]
  159. @AnEquivE[Tfn="DEFINE-INTEGRABLE",Efn="DEFSUBST"]
  160. @info[NOTES="Special form"]
  161. @descN[
  162. F1="(DEFINE-INTEGRABLE @i[variable value]) @yl[] @i[undefined]",
  163. FN1="DEFINE-INTEGRABLE",
  164. F2="(DEFINE-INTEGRABLE (@i[variable] . @i[arguments]) . @i[body]) @yl[] @i[undefined]"
  165. ]
  166. This is semantically identical to @tc[DEFINE], but also declares
  167. that the value of the variable is not expected to change.
  168. For example, if a reference to the variable is encountered in
  169. functional position in a call, its definition may be @i[integrated],
  170. that is, substituted in-line.
  171.     @BeginInset[Bug:]
  172.     TC 1.4 will blow up on integrating a recursive procedure defined with
  173.     @tc[DEFINE-INTEGRABLE].
  174.     @EndInset[]
  175. @EndDescN[]
  176. @Label[DefineIntegrableSection]
  177.  
  178. @section[Symbol generators]
  179. @index[Symbols]
  180.  
  181. @desc[(GENERATE-SYMBOL @i[prefix]) @yl[] @i[symbol]]
  182. Each call to @tc[GENERATE-SYMBOL] generates a unique identifier.  The
  183. form which the new identifier's name takes is not defined, but the
  184. identifier is guaranteed to be different from any identifier created
  185. in any other way.  The identifier's external representation will begin
  186. with @i[prefix].
  187.     @BeginInset[Bug:]
  188.     Uniqueness is not entirely guaranteed in @Timp[] 2.7, because
  189.     the resulting symbol, although obscurely named, may already exist
  190.     in the symbol table.
  191.     @EndInset[]
  192. @EndDesc[GENERATE-SYMBOL]
  193.  
  194. @desc[(CONCATENATE-SYMBOL . @i[things]) @yl[] @i[symbol]]
  195. Creates a symbol whose print name is obtained by appending the printed
  196. representations of @i[things] according to the @tc[DISPLAY] operation.
  197.   @begin[ProgramExample]
  198. (CONCATENATE-SYMBOL 'FOO- "THING-" 34)  @ev[]  FOO-THING-34
  199.   @end[ProgramExample]
  200. @EndDesc[CONCATENATE-SYMBOL]
  201.  
  202.  
  203. @section[Combinators]
  204. @index[Combinators]
  205.  
  206. @desc[(ALWAYS @i[value]) @yl[] @i[procedure]]
  207. Returns a procedure which ignores its arguments and always returns @i[value].
  208. @begin[ProgramExample]
  209. (ALWAYS @i[value]) @ce[] (LAMBDA X (IGNORE X) @i[value])
  210. @end[ProgramExample]
  211. @EndDesc[ALWAYS]
  212.  
  213. @desc[(IDENTITY @i[object]) @yl[] @i[object]]
  214. Identity function.  Returns its argument.
  215. @EndDesc[IDENTITY]
  216.  
  217. @desc[(PROJN @i[n]) @yl[] @i[procedure]]
  218. Returns a procedure which returns (projects) its @i[n]@+(th) argument, ignoring
  219. any others.
  220. @begin[ProgramExample]
  221. (PROJN 1)  @ce[]  (LAMBDA (A B . REST) (IGNORE A REST) B)
  222. @end[ProgramExample]
  223. @EndDesc[PROJN]
  224.  
  225. @desc[(PROJ0 @i[object . rest]) @yl[] @i[object]]
  226. Projection function: returns its zero@+(th) argument, ignoring the rest.
  227. @begin[ProgramExample]
  228. PROJ0  @ce[]  (PROJN 0)
  229. @end[ProgramExample]
  230. @tc[PROJ0] is similar to @tc[BLOCK0] (page @pageref[BLOCK0]), except
  231. that it is a procedure, not a special form.
  232. @EndDesc[PROJ0]
  233.  
  234. @desc[(PROJ1 @i[object0 object1 . rest]) @yl[] @i[object1]]
  235. Returns its second argument.
  236. @EndDesc[PROJ1]
  237.  
  238. @desc[(PROJ2 @i[object0 object1 object2 . rest]) @yl[] @i[object2]]
  239. Returns its third argument.
  240. @EndDesc[PROJ2]
  241.  
  242. @desc[(PROJ3 @i[object0 object1 object2 object3 . rest]) @yl[] @i[object3]]
  243. Returns its fourth argument.
  244. @EndDesc[PROJ3]
  245.  
  246. @desc[(CONJOIN . @i[predicates]) @yl[] @i[predicate]]
  247. Returns a predicate which is the logical conjunction of all of the
  248. @i[predicates].
  249. @begin[ProgramExample]
  250. ((CONJOIN >0? ODD?) 13)  @ev[]  @r[true]
  251. ((CONJOIN >0? ODD?) 8)  @ev[]  @r[false]
  252. @end[ProgramExample]
  253. @EndDesc[CONJOIN]
  254.  
  255. @desc[(DISJOIN . @i[predicates]) @yl[] @i[predicate]]
  256. Returns a predicate which is the logical disjunction of all of the
  257. @i[predicates].
  258. @begin[ProgramExample]
  259. ((DISJOIN >0? ODD?) 13)  @ev[]  @r[true]
  260. ((DISJOIN >0? ODD?) 8)  @ev[]  @r[true]
  261. @end[ProgramExample]
  262. @EndDesc[DISJOIN]
  263.  
  264. @desc[(COMPLEMENT @i[predicate])@ @yl() @i[predicate]]
  265. Returns a predicate which is the logical complement of the @i[predicate].
  266. @begin[ProgramExample]
  267. ATOM? @ce[] (COMPLEMENT PAIR?)
  268. ((COMPLEMENT MEMQ?) 'A '(X Y Z))  @ev[]  @r[true]
  269. @end[ProgramExample]
  270. @EndDesc[COMPLEMENT]
  271.  
  272. @desc[(COMPOSE . @i[procedures]) @yl[] @i[procedure]]
  273. Returns a procedure which is the composition of the @i[procedures].
  274. The last of the @i[procedures] may take any number of arguments, and the resulting
  275. procedure will take that same number of arguments; all the other
  276. @i[procedures] must take one argument.
  277. @begin[ProgramExample, LongLines Keep]
  278. @tabclear
  279. ((COMPOSE CAR CDR) '(A B)) @^@ev[]  B
  280. (COMPLEMENT @i[predicate]) @\@ce[]  (COMPOSE NOT @i[predicate])
  281. PROPER-LIST? @\@ce[]  (DISJOIN NULL? (COMPOSE NULL? CDR LASTCDR))
  282. NTH @\@ce[]  (COMPOSE CAR NTHCDR)
  283. @tabclear
  284. @end[ProgramExample]
  285. @EndDesc[COMPOSE]
  286.  
  287. @dc{ Is this the right place to talk about these things...? }
  288.  
  289. @info[NOTES="Type predicate"]
  290. @desc[(TRUE . @i[arguments]) @yl[] @i[true]]
  291. Ignores its arguments, and always returns true.
  292. This may be used as a predicate representing the @qu"universal type"
  293. @dash[] the type which subsumes all objects.
  294. @EndDesc[TRUE]
  295.  
  296. @info[NOTES="Type predicate"]
  297. @desc[(FALSE . @i[arguments]) @yl[] @i[false]]
  298. Ignores its arguments, and always returns false.
  299. This may be used as a predicate representing the @qu"null type" @dash[] the
  300. type which subsumes no objects.
  301. @EndDesc[FALSE]
  302.  
  303. @info[NOTES="Type predicate"]
  304. @desc[(TRUE? @i[value]) @yl[] @i[boolean]]
  305. Returns true if @i[value] is @i[some] true value, false otherwise.
  306. This is convenient where one wants to coerce a truth value
  307. to be a @i[standard] truth value; that is,
  308. @tc[TRUE?] maps false to itself, and any true value to
  309. the standard true value (@tc[T]).
  310. @begin[ProgramExample]
  311. @tabclear
  312. (TRUE? @i[object])  @^@ce[]  (NOT (FALSE? @i[object]))
  313. (TRUE? NIL)@\@ev[]  @r[false]
  314. (TRUE? T)@\@ev[]  @r[true]
  315. (TRUE? 3)@\@ev[]  @r[true]
  316. @tabclear
  317. @end[ProgramExample]
  318. @EndDesc[TRUE?]
  319.  
  320. @info[NOTES="Type predicate"]
  321. @desc[(BOOLEAN? @i[object]) @yl[] @i[boolean]]
  322. This returns true if @i[object] is either the standard true value
  323. or the standard false value.
  324. @dc{ It is a nearly useless predicate, and probably oughtn't be documented
  325. until such time as @tc[PROCLAIM] and types are better supported. }
  326. @begin[ProgramExample]
  327. (BOOLEAN? NIL)  @ev[]  @r[true]
  328. (BOOLEAN? T)    @ev[]  @r[true]
  329. (BOOLEAN? 3)    @ev[]  @r[false]
  330. @end[ProgramExample]
  331. @EndDesc[BOOLEAN?]
  332.  
  333.  
  334. @section[Vectors]
  335. @label[VectorsSection]  @Comment{ref: objects chapter}
  336. @index[Vectors]
  337.  
  338. @iix[Vectors] can be thought of as
  339. one-dimensional, zero-based arrays, or as fixed-length, random-access lists.
  340. They read and print like lists with a @tc[#] in front.
  341. Like lists, but unlike numbers and strings, vectors are not
  342. self-evaluating.  To write a constant vector, quote it: @wt['#(X Y (1 2))].
  343.  
  344. @Comment{@subsection[Predicates]}
  345.  
  346. @info[NOTES="Type predicate"]
  347. @desc[(VECTOR? @i[object]) @yl[] @i[boolean]]
  348. Returns true if @i[object] is a vector.
  349. @EndDesc[VECTOR?]
  350.  
  351. @Comment{@subsection[Constructors]}
  352.  
  353. @desc[(MAKE-VECTOR @i[size]) @yl[] @i[vector]]
  354. Returns a vector whose length is @i[size].
  355. The elements are not initialized to any particular value.
  356. @comment{All elements are not necessarily initialized to some useful value.
  357. Maybe later such initialization will become part of the definition of
  358. this routine, but for now, don't count on it.}
  359. @tc[VECTOR-FILL] (see below) may be used
  360. to fill the vector with some useful value (such as @tc[()]).
  361. @EndDesc[MAKE-VECTOR]
  362.  
  363. @desc[(LIST->VECTOR @i[list]) @yl[] @i[vector]]
  364. Converts a list to a vector.
  365. @begin[ProgramExample]
  366. (LIST->VECTOR '(A B C))  @ev[]  #(A B C)
  367. @end[ProgramExample]
  368. @EndDesc[LIST->VECTOR]
  369.  
  370. @desc[(VECTOR->LIST @i[vector]) @yl[] @i[list]]
  371. Converts a vector to a list.
  372. @begin[ProgramExample]
  373. (VECTOR->LIST '#(A B C))  @ev[]  (A B C)
  374. @end[ProgramExample]
  375. @EndDesc[VECTOR->LIST]
  376.  
  377. @Comment{@subsection[Selectors]}
  378.  
  379. @info[NOTES="Settable"]
  380. @descN[
  381. F1="(VECTOR-ELT @i[vector n]) @yl[] @i[object]", FN1="VECTOR-ELT",
  382. F2="(VREF @i[vector n]) @yl[] @i[object]", FN2="VREF"
  383. ]
  384. Accesses the @i[n]@+[th] element of @i[vector] (zero-based).
  385. @begin[ProgramExample]
  386. (VECTOR-ELT '#(A B C) 1) @ev[]  B
  387. @end[ProgramExample]
  388. @EndDescN[]
  389.  
  390. @desc[(VSET @i[vector n object]) @yl[] @i[object]]
  391. Sets the @i[n]@+[th] element of @i[vector] to @i[object].
  392.   @begin[ProgramExample]
  393. (VSET @i[vector n object]) @ce[] (SET (VREF @i[vector n]) @i[object])
  394.   @end[ProgramExample]
  395. @EndDesc[VSET]
  396.  
  397. @desc[(COPY-VECTOR @i[vector]) @yl[] @i[vector]]
  398. Makes a copy of @i[vector].
  399. @EndDesc[COPY-VECTOR]
  400.  
  401. @desc[(VECTOR-FILL @i[vector value]) @yl[] @i[vector]]
  402. Sets every element of @i[vector] to @i[value], and returns the
  403. modified @i[vector].
  404. @EndDesc[VECTOR-FILL]
  405.  
  406. @desc[(VECTOR-REPLACE @i[target source n]) @yl[] @i[vector]]
  407. Sets the first @i[n] elements of @i[target] to be the same as the
  408. corresponding elements of @i[source], and returns the (modified)
  409. @i[target].
  410. @EndDesc[VECTOR-REPLACE]
  411.  
  412. @desc[(VECTOR-LENGTH @i[vector]) @yl[] @i[integer]]
  413. Returns @i[vector]'s length.
  414. @EndDesc[VECTOR-LENGTH]
  415.  
  416. @desc[(VECTOR-POS @i[predicate object vector]) @yl[] @i[integer] @r[or] @i[false]]
  417. Returns index of the first element @i[x] of @i[vector]
  418. such that @tc[(@i[predicate object x])], or false if there is no such element.
  419. @EndDesc[VECTOR-POS]
  420.  
  421. @desc[(VECTOR-POSQ @i[object vector]) @yl[] @i[integer] @r[or] @i[false]]
  422. @begin[ProgramExample]
  423. (VECTOR-POSQ @i[object vector]) @ce[] (VECTOR-POS EQ? @i[object vector])
  424. @end[ProgramExample]
  425. @EndDesc[VECTOR-POSQ]
  426.  
  427. @desc[(WALK-VECTOR @i[procedure vector]) @yl[] @i[undefined]]
  428. Applies @i[procedure] to every element in @i[vector].
  429. @EndDesc[WALK-VECTOR]
  430.  
  431.  
  432. @section[Pools]
  433.  
  434. @dc{ More documentation should be written.  Talk about GC interaction, etc. }
  435.  
  436. @iix[Pools] give a convenient way to perform explicit storage management in T.
  437. One may obtain an object from a pool (popping the pool's free list, or
  438. creating a new object if the free list is empty), and later return an
  439. object to a pool.  By managing storage allocation in this way, the
  440. frequency of garbage collections @dc{where explained?} can be reduced.
  441. @index[Freelists]
  442.  
  443. All pools are emptied when a garbage collection occurs.  Garbage
  444. collections occur asynchronously in an implementation-dependent manner.
  445. @index[Garbage collection]
  446.  
  447. @desc[(MAKE-POOL @i[identification] @i[generator]) @yl[] @i[pool]]
  448. Creates a pool.  @i[Generator] should be a procedure, and will be
  449. called by @tc[OBTAIN-FROM-POOL] whenever the pool's free list is empty.
  450. @i[Identification] is only for identification purposes, for example,
  451. when the pool is printed.
  452. @enddesc[MAKE-POOL]
  453.  
  454. @desc[(OBTAIN-FROM-POOL @i[pool]) @yl[] @i[object]]
  455. Obtains an object from @i[pool].  If the pool is empty, the pool's generator
  456. is called to obtain an object, which is then returned directly.
  457. @enddesc[OBTAIN-FROM-POOL]
  458.  
  459. @desc[(RETURN-TO-POOL @i[pool] @i[object]) @yl[] @i[undefined]]
  460. Returns @i[object] to @i[pool].  A future call to
  461. @tc[OBTAIN-FROM-POOL] may yield @i[object].
  462. @enddesc[RETURN-TO-POOL]
  463.  
  464.  
  465. @section[Weak pointers]
  466.  
  467. @desc[(OBJECT-HASH @i[object]) @yl[] @i[integer]]
  468. Returns a unique numeric identifier for @i[object].
  469. That is,
  470.   @begin[ProgramExample]
  471. (EQ? @i[object1] @i[object2])
  472.   @end[ProgramExample]
  473. if and only if
  474.   @begin[ProgramExample]
  475. (= (OBJECT-HASH @i[object1]) (OBJECT-HASH @i[object2]))
  476.   @end[ProgramExample]
  477. Because @tc[OBJECT-HASH] is invertible (see below), it can be used
  478. to create @ix[weak pointers] to objects, that is, @qu"pointers" or
  479. @qu"references" which are not strong enough to prevent an object from
  480. being reclaimed by the garbage collector.  This concept of weak pointer
  481. is implemented by the integers returned by @tc[OBJECT-HASH], which
  482. can be dereferenced by calling @tc[OBJECT-UNHASH].
  483.  
  484. @tc[OBJECT-HASH] is used by standard methods for the @tc[PRINT] operation
  485. when printing objects which have no read syntax.
  486. @EndDesc[OBJECT-HASH]
  487.  
  488. @desc[(OBJECT-UNHASH @i[integer]) @yl[] @i[object] @r[or] @i[false]]
  489. Returns the object whose unique identifier is @i[integer],
  490. or false if the object is no longer accessible (e.g. due to garbage
  491. collection).
  492.   @begin[ProgramExample]
  493. (OBJECT-UNHASH (OBJECT-HASH @i[object]))  @ev[]  @i[object]
  494.   @end[ProgramExample]
  495. @EndDesc[OBJECT-UNHASH]
  496.  
  497. @iix[Populations] provide a way to keep track of a collection of objects.
  498. They are sometimes known as @iix[weak sets] because they behave much like
  499. sets, but an object in a population may go away if the only pointer to
  500. the object is via the population.  The garbage collector will remove
  501. such objects from populations.
  502. @index[Garbage collection]
  503.  
  504. @desc[(MAKE-POPULATION @i[identification]) @yl[] @i[population]]
  505. Creates a new population.
  506. @enddesc[MAKE-POPULATION]
  507.  
  508. @desc[(ADD-TO-POPULATION @i[population] @i[object]) @yl[] @i[undefined]]
  509. Adds @i[object] to @i[population].
  510. @enddesc[ADD-TO-POPULATION]
  511.  
  512. @desc[(REMOVE-FROM-POPULATION @i[population] @i[object]) @yl[] @i[undefined]]
  513. Removes @i[object] from @i[population].
  514. @enddesc[REMOVE-FROM-POPULATION]
  515.  
  516. @desc[(POPULATION->LIST @i[population]) @yl[] @i[list]]
  517. Returns a list of all objects currently in @i[population].  Note that as
  518. long as this list is accessible, none of the objects will be implicitly
  519. removed from the population, because they will be accessible via this list.
  520. @enddesc[POPULATION->LIST]
  521.  
  522. @desc[(WALK-POPULATION @i[population] @i[procedure]) @yl[] @i[undefined]]
  523. Calls @i[procedure] on each member of @i[population].
  524.   @begin[ProgramExample]
  525. (WALK-POPULATION @i[population] @i[procedure])
  526.   @ce[]
  527. (WALK @i[procedure] (POPULATION->LIST @i[population]))
  528.   @end[ProgramExample]
  529. @enddesc[WALK-POPULATION]
  530.